package com.zq.behavior.memento;

public class Client {
    public static void main(String[] args) {
        Originator originator = new Originator();
        originator.setName("David");
        originator.setPhone("110");
        originator.setBudget(1000);

        System.out.println(originator);

        Caretaker caretaker = new Caretaker();
        caretaker.setMemento(originator.saveMemento());

        originator.setName("Phoebe");
        originator.setPhone("119");
        originator.setBudget(1314);

        System.out.println(originator);

        originator.restoreMemento(caretaker.getMemento());

        System.out.println(originator);
    }
}
